// test for  Logger
#include "logger.h"
#include <gflags/gflags.h>
// 定义命令行参数
DEFINE_string(log_filepath, "", "log file path"); // 日志文件路径
DEFINE_int32(log_level, 0, "log level");          // 日志级别
DEFINE_string(log_startDate, "", "log Start Date"); // 日志开始时间 格式为YYYYMMDD

int main(int argc, char *argv[])
{
    google::ParseCommandLineFlags(&argc, &argv, true);
    try
    {
        // 设置日志文件路径
        Logger::InitLogger(FLAGS_log_filepath);
        Logger::setLogLevel(FLAGS_log_level); // 设置日志级别： 0-4  DEBUG-ALERT

        // 记录不同级别的日志
        LOG(Logger::DEBUG, "This is a debug message.");
        LOG(Logger::INFO, "This is an info message.");
        LOG(Logger::WARNING, "This is a warning message.");
        LOG(Logger::ERROR, "This is an error message.");
        LOG(Logger::ALERT, "This is an alert message.");

        // 输出日志到控制台
        PRINT_LOG(FLAGS_log_startDate);
        // PRINT_LOG();
    }
    catch (const std::exception &e)
    {
        std::cerr << "Exception in main: " << e.what() << std::endl;
    }

    return 0;
}